import { toRaw } from "vue"
export default {
  send(url: string, params?: any) {
    if (typeof window.electronAPI === "object") {
      return window.electronAPI.send(url, toRaw(params))
    }
  },
  listen(key: string, data: any, callback: Function) {
    if (typeof window.electronAPI === "object") {
      console.log("listen", key, data, callback)
      return window.electronAPI.listen(key, data, toRaw(callback))
    }
  },
  closeListen(key: string) {
    if (typeof window.electronAPI === "object") {
      console.log("close-listen", key)
      return window.electronAPI.closeListen(key)
    }
  },
}